n,s = map(int, input().split())
a = list(map(int, input().split()))

l, r , res, cnt = 0,0,0,0

while r < n and l < n:
  while r < n and res <= s:
    cnt += r - l
    res += a[r]
    r += 1
  while l < n and res > s:
    res -= a[l]
    l += 1
  while r == n and l < n and res <= s:
    cnt += 1
    res -= a[l]
    l += 1

print(cnt)